package com.power.sifa.approve.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.common.domain.YesNo;
import com.plf.core.base.model.Ha_attachment;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
*  送达详情送达人实体类
*/

@Entity
@ApiModel(value="送达详情送达人")
@Data
@Table(name="Apl_arrive_person",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Apl_arrive_person.Apl_arrive_personPK.class) 用于复合组件
@AllArgsConstructor
@Builder
public class Apl_arrive_person extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "序号")
    private String id;

    @ApiModelProperty(value = "送达记录id")
    private String recordid;

    @ApiModelProperty(value = "邮寄地址")
    private String address;

    @ApiModelProperty(value = "收件人")
    private String recipient;

    @ApiModelProperty(value = "联系电话")
    private String phone;

    @ApiModelProperty(value = "邮寄单号")
    private String postcode;

    @ApiModelProperty(value = "送达方式")
    private Integer sendway;

    /**
     * {@link com.power.sifa.approve.model.enumeration.St_arrive}
     */
    @ApiModelProperty(value = "送达状态")
    private Integer sendstatus;

    @ApiModelProperty(value = "送达时间", example="2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date sendtime;


    @ApiModelProperty(value = "是否被申请人")
    private Integer istarget = YesNo.NO;

    @ApiModelProperty(value = "附件图片信息")
    private String photoinfo;

    @ApiModelProperty(value = "公告送达")
    private String publicurl;

    /**
     *  送达方式文本
     */
    @Transient
    @FieldEnumText(eum="Tp_sendway", valuefield="sendway")
    private String sendway_text;

    /**
     *  送达状态文本
     */
    @Transient
    @FieldEnumText(eum="St_arrive", valuefield="sendstatus")
    private String sendstatus_text;

    /**
     *  是否被申请人文本
     */
    @Transient
    @FieldEnumText(eum="yesNo", valuefield="istarget")
    private String istarget_text;

    /**
     * 附件详情
     */
    @Transient
    private List<Ha_attachment> photoInfoList;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("recordid", this.getRecordid());
        map.put("address", this.getAddress());
        map.put("recipient", this.getRecipient());
        map.put("phone", this.getPhone());
        map.put("postcode", this.getPostcode());
        map.put("sendway_text", this.sendway_text);
        map.put("sendway", this.getSendway());
        map.put("sendstatus_text", this.sendstatus_text);
        map.put("sendstatus", this.getSendstatus());
        map.put("sendtime", this.getSendtime());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Apl_arrive_personPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Apl_arrive_personPK pk = (Apl_arrive_personPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}